<?php

/**
 * CustomarOrderProduct filter form base class.
 *
 * @package    Onnobostro
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseCustomarOrderProductFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'product_id'        => new sfWidgetFormDoctrineChoice(array('model' => 'Product', 'add_empty' => true)),
      'customar_order_id' => new sfWidgetFormDoctrineChoice(array('model' => 'CustomarOrder', 'add_empty' => true)),
      'quantity'          => new sfWidgetFormDmFilterInput(),
      'unit_cost'         => new sfWidgetFormDmFilterInput(),
      'size'              => new sfWidgetFormDmFilterInput(),
      'color'             => new sfWidgetFormDmFilterInput(),
    ));

    $this->setValidators(array(
      'product_id'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Product'), 'column' => 'id')),
      'customar_order_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('CustomarOrder'), 'column' => 'id')),
      'quantity'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'unit_cost'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'size'              => new sfValidatorPass(array('required' => false)),
      'color'             => new sfValidatorPass(array('required' => false)),
    ));
    

    $this->widgetSchema->setNameFormat('customar_order_product_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'CustomarOrderProduct';
  }

  public function getFields()
  {
    return array(
      'id'                => 'Number',
      'product_id'        => 'ForeignKey',
      'customar_order_id' => 'ForeignKey',
      'quantity'          => 'Number',
      'unit_cost'         => 'Number',
      'size'              => 'Text',
      'color'             => 'Text',
    );
  }
}
